<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html, body, #app {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
    <div id="app">
    </div>
    <script>
        const app = document.getElementById('app');
        const canvas = document.createElement('canvas');
        canvas.id = 'canvas';
        app.appendChild(canvas);
        canvas.style.width = '1024px';
        canvas.style.height = '1024px';
        canvas.width = 1024;
        canvas.height = 1024;
        const ctx = canvas.getContext('2d');

        const img = new Image();
        img.src= 'assets/sun_temple_stripe.jpg';
        img.onload = () => {
            for (let i = 0; i < 6; i += 1) {
                ctx.drawImage(img, i * 1024, 0, 1024, 1024, 0, 0, 1024, 1024);
                const a = document.createElement('a');
                a.download = `${i}.jpg`;
                a.href = canvas.toDataURL();
                a.click();
            }
           
        }
    </script>
</body>
</html>